import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  // base: "./",
  server: {
    // 反向代理
    proxy: {
      '/api/': {
        target: 'http://43.139.99.222:8077', //实际请求地址
        changeOrigin: true,
        rewrite: path => path.replace(/^\/api/, ''),
      },
    },
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
    },
  },
  define: {
    'process.env': {
      // 'BASE_API': "http://43.139.99.222:8077"
      'BASE_API': "/api/"
    }
  }
});
